import 'package:p_location/alarm/obj/major_hazard_obj.dart';

class MajorHazardListRes {
  int code;
  String msg;
  MajorListItem data;

  MajorHazardListRes({this.code, this.msg, this.data});

  factory MajorHazardListRes.fromJson(Map<String, dynamic> json) {
    return MajorHazardListRes(
        code: json['code'],
        msg: json['msg']?? '',
        data: MajorListItem.fromJson(json['data']));
  }
}

class MajorListItem {
  List<MajorHazardObj> records;
  int total;
  int size;
  int current;
  bool searchCount;
  int pages;

  MajorListItem(
      {this.records,
      this.total,
      this.size,
      this.current,
      this.searchCount,
      this.pages});

  factory MajorListItem.fromJson(Map<String, dynamic> json) {
    var listItemJson = json['records'] as List;
    List<MajorHazardObj> records = [];
    if (listItemJson != null) {
      records = listItemJson.map((i) => MajorHazardObj.fromJson(i)).toList();
    }
    return MajorListItem(
        records: records,
        total: json['total'],
        size: json['size'],
        current: json['current'],
        searchCount: json['searchCount'],
        pages: json['pages'],);
  }
}
